package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
public class Test2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream file=new FileOutputStream("note.txt");
        OutputStreamWriter ows=new OutputStreamWriter(file, StandardCharsets.UTF_8);
        Scanner scan=new Scanner(System.in);
        while (true){
            System.out.println("请输入一串字符");
            String s=scan.nextLine();
            if ("exit".equalsIgnoreCase(s)){
                break;
            }else {
                ows.write(s);
                System.out.println("写入完毕");
            }
            ows.close();
        }
    }
}
